package org.redmagic.ui;

import com.fasterxml.jackson.annotation.JsonProperty;

public class UiPropertyResponse {

	private static final String FAILED_RESULT = "ERROR";
	private static final String SUCCESS_RESULT = "OK";

	public static UiPropertyResponse getFailedResponse(String message) {
		return new UiPropertyResponse(FAILED_RESULT, null, message);
	}
	
	public static UiPropertyResponse getSuccessResponse(UiProperty property) {
		return new UiPropertyResponse(SUCCESS_RESULT, property, null);
	}
 
    private final String result;
    private final UiProperty property; 
    private final String message;

    private UiPropertyResponse(String result, UiProperty property, String message) {
        this.result = result;
        this.property = property;
        this.message = message;
    }
 
    @JsonProperty("Result")
    public String getResult() {
        return result;
    }
 
    @JsonProperty("Record")
    public UiProperty getProperty() {
        return property;
    } 
 
    @JsonProperty("Message")
    public String getMessage() {
        return message;
    }
 
}